// 封装本地存储操作

// 取值操作
export const getItem = (key) => {
	let data = localStorage.getItem(key)
	try {
		data = JSON.parse(data)
		return data
	} catch (error) {
		return data
	}
}
// 存值操作
export const setItem = (key, val) => {
	if (typeof val === 'object') {
		localStorage.setItem(key, JSON.stringify(val))
	} else {
		localStorage.setItem(key, val)
	}
}
// 删值操作
export const removeItem = (key) => {
	localStorage.removeItem(key)
}
